#ifndef __VECTOR_H__
#define __VECTOR_H__

#include "Math.h"

template <int N,class Real>
class Vector
{
public:
	// construction
	Vector();
	Vector(const Real* tuple);
	Vector(const Vector<N,Real>& vec);

	// coordinate access
	operator const Real* () const;
	operator Real* ();
	Real operator[] (int i) const;
	Real& operator[] (int i);

	// assignment
	Vector<N,Real>& operator= (const Vector<N,Real>& vec);

	// comparison
	bool operator== (const Vector<N,Real>& vec) const;
	bool operator!= (const Vector<N,Real>& vec) const;
	bool operator<  (const Vector<N,Real>& vec) const;
	bool operator<= (const Vector<N,Real>& vec) const;
	bool operator>  (const Vector<N,Real>& vec) const;
	bool operator>= (const Vector<N,Real>& vec) const;

	// arithmetic operations
	Vector<N,Real> operator+ (const Vector<N,Real>& vec) const;
	Vector<N,Real> operator- (const Vector<N,Real>& vec) const;
	Vector<N,Real> operator* (Real a) const;
	Vector<N,Real> operator/ (Real a) const;
	Vector<N,Real> operator- () const;

	// arithmentic updates
	Vector<N,Real>& operator+= (const Vector<N,Real>& vec);
	Vector<N,Real>& operator-= (const Vector<N,Real>& vec);
	Vector<N,Real>& operator*= (Real a);
	Vector<N,Real>& operator/= (Real a);


	// vector operations
	Real Length() const;
	Real SquaredLength() const;
	Real Dot(const Vector<N,Real>& vec) const;
	Real Normalize();

protected:
	// support for comparisons
	int CompareArrays(const Vector<N,Real>& vec) const;
	Real entries[N];
};

#endif




